package com.palm.hubo2o.ui;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;

import com.palm.hubo2o.ui.fragment.LotteryFragment;
import com.palm.hubo2o.ui.fragment.SSQBankerFragment;
import com.palm.hubo2o.ui.fragment.SSQNormFragment;
import com.palm.hubo2o.util.EnumCode;

/**
 * Created by dest1 on 2015/9/25.
 */
public class SSQLotteryActivity extends LotteryActivity {
    private LotteryFragment ssqNorm;
    private LotteryFragment ssqBrank;

    @NonNull
    @Override
    protected EnumCode.gameId gameId() {
        return EnumCode.gameId.SSQ;
    }


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ssqNorm = new SSQNormFragment();
        ssqNorm.setTitle("普通");
        ssqBrank = new SSQBankerFragment();
        ssqBrank.setTitle("胆拖");
        setFragments(ssqNorm, ssqBrank);
        handleLimitPick(getIntent());
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        handleLimitPick(intent);
    }

    private void handleLimitPick(Intent intent) {
        EnumCode.PlayType playType = (EnumCode.PlayType) intent.getSerializableExtra(EnumCode.PlayType.class.getName());
        if (playType != null) {
            switch (playType) {
                case SSQ_DS:
                case SSQ_FS:
                    vp.setEnabled(false);
                    tab.getTabAt(0).select();
                    tab.setVisibility(View.GONE);
                    break;
                case SSQ_DT:
                    vp.setEnabled(false);
                    tab.getTabAt(1).select();
                    tab.setVisibility(View.GONE);
                    break;
                default:
                    break;
            }
        }
    }
}
